<!DOCTYPE html>
<html>
  <head>
    <meta charset="UTF-8">
    <title>beeplay.js - write a song in javascript</title>
    <link rel="stylesheet" type="text/css" href="components/bootstrap/dist/css/bootstrap.min.css">
    <link rel="stylesheet" type="text/css" href="css/cover.css">
    <link rel="stylesheet" type="text/css" href="css/prettify.css">
    <link rel="stylesheet" type="text/css" href="css/main.css">
  </head>
  <body>
  <a href="https://github.com/watilde/beeplay"><img style="position: absolute; top: 0; right: 0; border: 0;" src="https://camo.githubusercontent.com/52760788cde945287fbb584134c4cbc2bc36f904/68747470733a2f2f73332e616d617a6f6e6177732e636f6d2f6769746875622f726962626f6e732f666f726b6d655f72696768745f77686974655f6666666666662e706e67" alt="Fork me on GitHub" data-canonical-src="https://s3.amazonaws.com/github/ribbons/forkme_right_white_ffffff.png"></a>
    <div class="site-wrapper">
      <div class="site-wrapper-inner">
        <div class="cover-container">
          <div class="masthead clearfix">
            <div class="inner">
              <h3 class="masthead-brand">beeplay.js</h3>
              <ul class="nav masthead-nav">
                <li class="active"><a href="#">Home</a></li>
                <li><a href="https://github.com/watilde/beeplay">Github</a></li>
              </ul>
            </div>
          </div>
          <div class="inner cover">
            <h1 class="cover-heading">Write A Song In JavaScript</h1>
            <pre id="code" class="prettyprint">
function nyan(option) {
  var bpm = option.bpm || 120;
  // Intro
  var intro = beeplay({bpm: bpm})
    .play(null, 2)
    .play('D#5', 1/4).play('E5', 1/4).play('F#5', 1/2)
    .play('B5', 1/2).play('D#5', 1/4).play('E5', 1/4)
    .play('F#5', 1/4).play('B5', 1/4).play('C#6', 1/4).play('D#6', 1/4)
    .play('C#6', 1/4).play('A#5', 1/4).play('B5', 1/2)
    .play('F#5', 1/2).play('D#5', 1/4).play('E5', 1/4)
    .play('F#5', 1/2).play('B5', 1/2)
    .play('C#6', 1/4).play('A#5', 1/4).play('B5', 1/4).play('C#6', 1/4)
    .play('E6', 1/4).play('D#6', 1/4).play('E6', 1/4).play('C#6', 1/4);

  // Amero 1st
  var a1 = beeplay({bpm: bpm})
    .play(null, 2)
    .play(null, 8)
    .play('F#6', 1/2).play('G#6', 1/2)
    .play('C#6', 1/4).play('D#6', 1/2).play('B5', 1/4)
    .play('D6', 1/4).play('C#6', 1/4).play('B5', 1/2)
    .play('B5', 1/2).play('C#6', 1/2)
    .play('D6', 1/2).play('D6', 1/4).play('C#6', 1/4)
    .play('B5', 1/4).play('C#6', 1/4).play('D#6', 1/4).play('F#6', 1/4)
    .play('G#6', 1/4).play('D#6', 1/4).play('F#6', 1/4).play('C#6', 1/4)
    .play('D6', 1/4).play('B5', 1/4).play('C#6', 1/4).play('B5', 1/4)
    .play('D#6', 1/2).play('F#6', 1/2)
    .play('G#6', 1/4).play('D#6', 1/4).play('F#6', 1/4).play('C#6', 1/4)
    .play('D#6', 1/4).play('B5', 1/4).play('D6', 1/4).play('D#6', 1/4)
    .play('D6', 1/4).play('C#6', 1/4).play('B5', 1/4).play('C#6', 1/4)
    .play('D6', 1/2).play('B5', 1/4).play('C#6', 1/4)
    .play('D#6', 1/4).play('F#6', 1/4).play('C#6', 1/4).play('D6', 1/4)
    .play('C#6', 1/4).play('B5', 1/4).play('C#6', 1/2)
    .play('B5', 1/2).play('C#6', 1/2);

  // Amero 2nd
  var a2 = beeplay({bpm: bpm})
    .play(null, 2)
    .play(null, 8)
    .play(null, 16)
    .play('F#6', 1/2).play('G#6', 1/2)
    .play('C#6', 1/4).play('D#6', 1/2).play('B5', 1/4)
    .play('D6', 1/4).play('C#6', 1/4).play('B5', 1/2)
    .play('B5', 1/2).play('C#6', 1/2)
    .play('D6', 1/2).play('D6', 1/4).play('C#6', 1/4)
    .play('B5', 1/4).play('C#6', 1/4).play('D#6', 1/4).play('F#6', 1/4)
    .play('G#6', 1/4).play('D#6', 1/4).play('F#6', 1/4).play('C#6', 1/4)
    .play('D6', 1/4).play('B5', 1/4).play('C#6', 1/4).play('B5', 1/4)
    .play('D#6', 1/2).play('F#6', 1/2)
    .play('G#6', 1/4).play('D#6', 1/4).play('F#6', 1/4).play('C#6', 1/4)
    .play('D#6', 1/4).play('B5', 1/4).play('D6', 1/4).play('D#6', 1/4)
    .play('D6', 1/4).play('C#6', 1/4).play('B5', 1/4).play('C#6', 1/4)
    .play('D6', 1/2).play('B5', 1/4).play('C#6', 1/4)
    .play('D#6', 1/4).play('F#6', 1/4).play('C#6', 1/4).play('D6', 1/4)
    .play('C#6', 1/4).play('B5', 1/4).play('C#6', 1/2)
    .play('B5', 1/2).play('B5', 1/2);

  // Bmero 1st
  var b1 = beeplay({bpm: bpm})
    .play(null, 2)
    .play(null, 8)
    .play(null, 16)
    .play(null, 16)
    .play('B5', 1/2).play('F#5', 1/4).play('G#5', 1/4)
    .play('B5', 1/2).play('F#5', 1/4).play('G#5', 1/4)
    .play('B5', 1/4).play('C#6', 1/4).play('D#6', 1/4).play('B5', 1/4)
    .play('E6', 1/4).play('D#6', 1/4).play('E6', 1/4).play('F#6', 1/4)
    .play('B5', 1/2).play('B5', 1/2)
    .play('F#5', 1/4).play('G#5', 1/4).play('B5', 1/4).play('F#5', 1/4)
    .play('E6', 1/4).play('D#6', 1/4).play('C#6', 1/4).play('B5', 1/4)
    .play('F#5', 1/4).play('D#5', 1/4).play('E5', 1/4).play('F#5', 1/4)
    .play('B5', 1/2).play('F#5', 1/4).play('G#5', 1/4)
    .play('B5', 1/2).play('F#5', 1/4).play('G#5', 1/4)
    .play('B5', 1/4).play('B5', 1/4).play('C#6', 1/4).play('D#6', 1/4)
    .play('C#6', 1/4).play('F#5', 1/4).play('G#5', 1/4).play('F#5', 1/4)
    .play('B5', 1/2).play('B5', 1/4).play('A#5', 1/4)
    .play('B5', 1/4).play('F#5', 1/4).play('G#5', 1/4).play('B5', 1/4)
    .play('E6', 1/4).play('D#6', 1/4).play('E6', 1/4).play('F#6', 1/4)
    .play('B5', 1/2).play('A#5', 1/2);

  // Bmero 2nd
  var b2 = beeplay({bpm: bpm})
    .play(null, 2)
    .play(null, 8)
    .play(null, 16)
    .play(null, 16)
    .play(null, 16)
    .play('B5', 1/2).play('F#5', 1/4).play('G#5', 1/4)
    .play('B5', 1/2).play('F#5', 1/4).play('G#5', 1/4)
    .play('B5', 1/4).play('C#6', 1/4).play('D#6', 1/4).play('B5', 1/4)
    .play('E6', 1/4).play('D#6', 1/4).play('E6', 1/4).play('F#6', 1/4)
    .play('B5', 1/2).play('B5', 1/2)
    .play('F#5', 1/4).play('G#5', 1/4).play('B5', 1/4).play('F#5', 1/4)
    .play('E6', 1/4).play('D#6', 1/4).play('C#6', 1/4).play('B5', 1/4)
    .play('F#5', 1/4).play('D#5', 1/4).play('E5', 1/4).play('F#5', 1/4)
    .play('B5', 1/2).play('F#5', 1/4).play('G#5', 1/4)
    .play('B5', 1/2).play('F#5', 1/4).play('G#5', 1/4)
    .play('B5', 1/4).play('B5', 1/4).play('C#6', 1/4).play('D#6', 1/4)
    .play('C#6', 1/4).play('F#5', 1/4).play('G#5', 1/4).play('F#5', 1/4)
    .play('B5', 1/2).play('B5', 1/4).play('A#5', 1/4)
    .play('B5', 1/4).play('F#5', 1/4).play('G#5', 1/4).play('B5', 1/4)
    .play('E6', 1/4).play('D#6', 1/4).play('E6', 1/4).play('F#6', 1/4)
    .play('B5', 1/2).play('C#6', 1/2);

  // Back
  // A
  var back = beeplay({bpm: bpm})
    .play(null, 2)
    .play(null, 8)
    .play('E3', 1/2).play(['B3', 'E4'], 1/2)
    .play('F#3', 1/2).play(['C#4', 'F#4'], 1/2)
    .play('D#3', 1/2).play(['A#3', 'D#4'], 1/2)
    .play('G#3', 1/2).play(['D#4', 'G#4'], 1/2)
    .play('C#3', 1/2).play(['G#3', 'C#4'], 1/2)
    .play('F#3', 1/2).play(['C#4', 'F#4'], 1/2)
    .play('B2', 1/2).play(['F#3', 'B3'], 1/2)
    .play('C#3', 1/4).play('C#4', 1/4).play('D#3', 1/4).play('D#4', 1/4)
    // B
    .play('E3', 1/2).play(['B3', 'E4'], 1/2)
    .play('F#3', 1/2).play(['C#4', 'F#4'], 1/2)
    .play('D#3', 1/2).play(['A#3', 'D#4'], 1/2)
    .play('G#3', 1/2).play(['D#4', 'G#4'], 1/2)
    .play('C#3', 1/2).play(['G#3', 'C#4'], 1/2)
    .play('F#3', 1/2).play(['C#4', 'F#4'], 1/2)
    .play('B2', 1/2).play(['F#3', 'B3'], 1/2)
    .play('B2', 1/2).play(['F#3', 'B3'], 1/2)
    // loop
    .play('E3', 1/2).play(['B3', 'E4'], 1/2)
    .play('F#3', 1/2).play(['C#4', 'F#4'], 1/2)
    .play('D#3', 1/2).play(['A#3', 'D#4'], 1/2)
    .play('G#3', 1/2).play(['D#4', 'G#4'], 1/2)
    .play('C#3', 1/2).play(['G#3', 'C#4'], 1/2)
    .play('F#3', 1/2).play(['C#4', 'F#4'], 1/2)
    .play('B2', 1/2).play(['F#3', 'B3'], 1/2)
    .play('C#3', 1/4).play('C#4', 1/4).play('D#3', 1/4).play('D#4', 1/4)
    .play('E3', 1/2).play(['B3', 'E4'], 1/2)
    .play('F#3', 1/2).play(['C#4', 'F#4'], 1/2)
    .play('D#3', 1/2).play(['A#3', 'D#4'], 1/2)
    .play('G#3', 1/2).play(['D#4', 'G#4'], 1/2)
    .play('C#3', 1/2).play(['G#3', 'C#4'], 1/2)
    .play('F#3', 1/2).play(['C#4', 'F#4'], 1/2)
    .play('B2', 1/2).play(['F#3', 'B3'], 1/2)
    .play('B2', 1/2).play(['F#3', 'B3'], 1/2)
    .play('E3', 1/2).play(['B3', 'E4'], 1/2)
    .play('F#3', 1/2).play(['C#4', 'F#4'], 1/2)
    .play('D#3', 1/2).play(['A#3', 'D#4'], 1/2)
    .play('G#3', 1/2).play(['D#4', 'G#4'], 1/2)
    .play('C#3', 1/2).play(['G#3', 'C#4'], 1/2)
    .play('F#3', 1/2).play(['C#4', 'F#4'], 1/2)
    .play('B2', 1/2).play(['F#3', 'B3'], 1/2)
    .play('C#3', 1/4).play('C#4', 1/4).play('D#3', 1/4).play('D#4', 1/4)
    .play('E3', 1/2).play(['B3', 'E4'], 1/2)
    .play('F#3', 1/2).play(['C#4', 'F#4'], 1/2)
    .play('D#3', 1/2).play(['A#3', 'D#4'], 1/2)
    .play('G#3', 1/2).play(['D#4', 'G#4'], 1/2)
    .play('C#3', 1/2).play(['G#3', 'C#4'], 1/2)
    .play('F#3', 1/2).play(['C#4', 'F#4'], 1/2)
    .play('B2', 1/2).play(['F#3', 'B3'], 1/2)
    .play('B2', 1/2).play(['F#3', 'B3'], 1/2)
    .play('E3', 1/2).play(['B3', 'E4'], 1/2)
    .play('F#3', 1/2).play(['C#4', 'F#4'], 1/2)
    .play('D#3', 1/2).play(['A#3', 'D#4'], 1/2)
    .play('G#3', 1/2).play(['D#4', 'G#4'], 1/2)
    .play('C#3', 1/2).play(['G#3', 'C#4'], 1/2)
    .play('F#3', 1/2).play(['C#4', 'F#4'], 1/2)
    .play('B2', 1/2).play(['F#3', 'B3'], 1/2)
    .play('C#3', 1/4).play('C#4', 1/4).play('D#3', 1/4).play('D#4', 1/4)
    .play('E3', 1/2).play(['B3', 'E4'], 1/2)
    .play('F#3', 1/2).play(['C#4', 'F#4'], 1/2)
    .play('D#3', 1/2).play(['A#3', 'D#4'], 1/2)
    .play('G#3', 1/2).play(['D#4', 'G#4'], 1/2)
    .play('C#3', 1/2).play(['G#3', 'C#4'], 1/2)
    .play('F#3', 1/2).play(['C#4', 'F#4'], 1/2)
    .play('B2', 1/2).play(['F#3', 'B3'], 1/2)
    .play('B2', 1/2).play(['F#3', 'B3'], 1/2);
}</pre>
            <button id="play" class="btn btn-lg btn-primary">
              <span class="glyphicon glyphicon-play"></span>
            </button>
            <a href="js/nyan.js" target="_blank">nyan.js</a>
            /
            <a href="http://jsfiddle.net/S66zA/" target="_blank">Edit in jsfiddle</a>
          </div>
          <div class="mastfoot">
            <div class="inner">
              <p><a href="https://github.com/watilde">@watilde</a></p>
            </div>
          </div>
        </div>
      </div>
    </div>
    <script src="components/jquery/dist/jquery.min.js"></script>
    <script src="components/bootstrap/dist/js/bootstrap.min.js"></script>
    <script src="js/prettify.js"></script>
    <script src="js/beeplay.min.js"></script>
    <script src="js/nyan.js"></script>
    <script src="js/main.js"></script>
    <script>
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
 (i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
 m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
 })(window,document,'script','//www.google-analytics.com/analytics.js','ga');
ga('create', 'UA-35821550-3', 'watilde.github.io');
ga('send', 'pageview');
    </script>
  </body>
</html>
